<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    你好

    <script>
        console.log(top)
        let input = document.createElement("input")
        input.setAttribute("type", "text")
        document.body.after(input)


        function slide(elem, direction) {
            const keyframe = [
                { transform: 'translateX(-50%)', opacity: 0 },
                { transform: 'translateX(0%)', opacity: 1 }
            ]
            return elem.animate(keyframe,{
                fill:"forwards",
                duration:300,
                easing:"ease-in-out"
            })
        }
        let event= slide(input)

        // 这里可以移除掉这个元素
        event.onfinish=(e)=>{
            console.log(e,this)
        }
    </script>
</body>

</html>